package com.rex.repository;

import com.rex.domain.Goods;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by frt on 2017/11/2.
 *
 */
public interface IGoodsRepository extends JpaRepository<Goods, Long> {
    Goods findByGoodsName(String goodsName);

    Goods findByGoodsNameAndPrice(String goodsName, Double price);

    @Query("SELECT G FROM Goods G WHERE G.goodsName like :goodsName")
    List<Goods> queryAllByGoodsName(@Param("goodsName") String goodsName);
}
